<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>头像</title>
    <style>
        .aui-info {
            position: relative;
            background-color: aquamarine;
            height: 10rem;
        }

        .fileInput {
            position: absolute;
            top: 0;
            bottom: 0;
            left: 0;
            right: 0;
            opacity: 0;
            display: block;
            width: 3.5rem;
            clear: both;
            display: block;
            margin: auto;
            background-color: red;
        }
    </style>

</head>

<body>

    <div class="aui-info">
        <img src="images/green.jpg" id="img-txz" style="width: 3rem" class="aui-img-round user-img" />
        <input type="file" accept="image/*" id="file-txz" name="file" onchange="upload('#file-txz', '#img-txz');"
            class="fileInput" value="" />
    </div>

    <script src="./jquery-3.5.1.min.js"></script>
<!-- 
    <script type="text/javascript">
        var upload = function (c, d) {
            "use strict";
            var $c = document.querySelector(c),
                $d = document.querySelector(d),
                file = $c.files[0],
                reader = new FileReader();
            reader.readAsDataURL(file);
            reader.onload = function (e) {
                $d.setAttribute("src", e.target.result);
            };
        };

    </script> -->


</body>

</html>